﻿using Microsoft.AspNetCore.Mvc;

namespace Edu.Utilities
{
    public static class IUrlHelperExtensions
    {
        public static string RootUrl(this IUrlHelper helper)
        {
            return helper.Content("~/");
        }

        public static string Normalize(this IUrlHelper helper, string url)
        {
            if (url.Contains("://"))
            {
                return url;
            }
            return helper.RootUrl() + url.TrimStart(new char[] { '/', '\\' });
        }
    }
}
